from urllib import request
req=request.urlopen('http://www.imooc.com/course/list')
buf=req.read()
import re
jpgurl=re.findall(r'//.+\.jpg',str(buf,'utf=8'))
pngurl=re.findall(r'//.+\.png',str(buf,'utf=8'))
i=0
for url in jpgurl:
    url="http:"+url
    f=open(str(i)+'.jpg','wb')
    req=request.urlopen(url)
    buf=req.read()
    f.write(buf)
    i+=1
for url in pngurl:
    url="http:"+url
    f=open(str(i)+'.png','wb')
    req=request.urlopen(url)
    buf=req.read()
    f.write(buf)
    i+=1
